<template>
    <div class="front loginIndex">
        <!-- 主题 -->
        <div class="subject absolute" v-show="status !== 5 && status !== 6 && status !== 7">
            <div class="img">
                <img src="../../assets/images/subject-text.png" alt="">
            </div>
        </div>
        <!-- 用户协议 -->
        <UserAgree v-show="status === 5"/>
        <!-- 忘记密码 -->
        <FindPass v-show="status === 6"/>
        <!-- 查看账套 -->
        <ViewAccoutSet v-show="status === 7"/>
        <!-- 登录组件 -->
        <div class="loginTab relative" v-show="status !== 5 && status !== 6 && status !== 7">
            <!-- 手机号码登录 -->
            <PhoneLogin v-show="status === 4"/>
            <!-- 基本登录注册 -->
            <el-tabs v-model="loginType" v-show="status !== 4">
                <el-tab-pane label="账套登录" name="1">
                    <AccoutSetLogin/>
                </el-tab-pane>
                <el-tab-pane label="会员登录" name="2">
                    <MemberLogin/>
                </el-tab-pane>
                <el-tab-pane label="注册" name="3">
                    <Register/>
                </el-tab-pane>
            </el-tabs>
        </div>
    </div>
</template>
<script>
import AccoutSetLogin from './AccoutSetLogin'
import Register from './register'
import MemberLogin from './MemberLogin'
import PhoneLogin from './phoneLogin'
import UserAgree from './userAgree'
import FindPass from './findPass'
import ViewAccoutSet from './viewAccountSet'
export default {
    components: {
        AccoutSetLogin,
        MemberLogin,
        Register,
        PhoneLogin,
        UserAgree,
        FindPass,
        ViewAccoutSet
    },
    data() {
        return {
            loginType: '3'
        }
    },
    computed: {
        status() {      //当前状态
            let status = this.$store.state.loginStore.status;
            this.loginType = String(status);
            return status;
        }
    },
    watch: {
        loginType(newVal) {
            this.$store.commit('loginStore/updateStatus', Number(newVal));
        }
    },
    created() {
        this.$store.commit('loginStore/updateStatus', 2);
    }
}
</script>
<style scoped>
    .front {
        background: url(../../assets/images/log-bg.jpg) center;
        background-size: cover;
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }
    .subject {
        background-color: rgba(0, 0, 0, .4);
        width: 100%;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    .subject .img {
        width: 50%;
        padding: 60px 0;
    }
    .subject .img > img {width: 100%;margin-left: 5%;line-height: 1;}
    .loginTab {
        background-color: #fff;
        box-sizing: border-box;
        padding: 0 20px 5px;
        width: 350px;
        border-radius: 2px;
        z-index: 3;
        margin-right: 3%;
    }
</style>